package com.lingyi.algorithm.lab2;

/**
 * 快慢指针
 * @author chenweilong
 * @email 1433471850@qq.com
 * @date 2020-08-20 10:26
 */
public class SpeedPointer {


    public static void main(String[] args) {

        Node<Integer> node = MergeLinkList.initNode(1,2,3,4,5,6,7,8,9,10,11,12,13);

        int j = 0;

        Node<Integer> k = node;
        Node<Integer> m = node;

        while (k != null && k.getNext() != null) {
            k = k.getNext().getNext();
            m = m.getNext();
            j++;
        }

        System.out.println(j);
        System.out.println(m.getT());

    }


}
